import 'package:deepseek_client/widget/MDTypewriterText.dart';
import 'package:markdown/markdown.dart' as m;
import 'package:flutter/material.dart';
import 'package:markdown_widget/markdown_widget.dart';

class ThinkNode extends ElementNode {
  final m.Element element;
  final Function onComplete;
  final Function onLineBreak;
  final WidgetVisitor visitor;

  ThinkNode(this.visitor,
      {required this.element,
      required this.onComplete,
      required this.onLineBreak});

  @override
  InlineSpan build() {
    TextStyle describeStyle = const TextStyle(
        color: Color(0xFF8E8E8E),
        height: 2,
        fontSize: 16,
        decoration: TextDecoration.none,
        fontWeight: FontWeight.w600);
    return WidgetSpan(
        child: childrenSpan.text == null &&
                childrenSpan.children?.isEmpty == true
            ? const SizedBox()
            : Container(
                width: double.infinity,
                decoration: BoxDecoration(
                    color: const Color(0xAAE6E6E6),
                    borderRadius: BorderRadius.circular(10)),
                margin: const EdgeInsets.only(bottom: 20),
                padding: const EdgeInsets.only(
                    left: 20, right: 20, top: 10, bottom: 10),
                // child: MDTypewriterText(
                //     textSpan: TextSpan(
                //         children: [childrenSpan], style: describeStyle),
                //     onComplete: onComplete,
                //     onLineBreak: onLineBreak),
                child: Text.rich(
                    TextSpan(children: [childrenSpan], style: describeStyle)),
              ));
  }
}
